package _designPatterm.迭代器模式;

import java.util.Iterator;

public class ComputerCollegeIteratror implements Iterator {
    Department[] departments;
    int position = 0;

    public ComputerCollegeIteratror(Department[] departments) {
        this.departments = departments;
    }

    @Override
    public boolean hasNext() {
        if (position >= departments.length || departments[0] == null) {
            return false;
        } else {
            return true;
        }
    }

    @Override
    public Object next() {

        Department department = departments[position];
        position += 1;
        return department;
    }

    @Override
    public void remove() {

    }


}
